package com.pomr.model.equipmentstorage;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity
@Table(name="monitoring_data")
public class MonitoringData implements Serializable{
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getUpstr() {
		return upstr;
	}

	public void setUpstr(String upstr) {
		this.upstr = upstr;
	}

	public String getImei() {
		return imei;
	}

	public void setImei(String imei) {
		this.imei = imei;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getData() {
		return data;
	}

	public void setData(String data) {
		this.data = data;
	}

	public Date getMonitorTime() {
		return monitorTime;
	}

	public void setMonitorTime(Date monitorTime) {
		this.monitorTime = monitorTime;
	}

	public EquipmentLeader getLeader() {
		return leader;
	}

	public void setLeader(EquipmentLeader leader) {
		this.leader = leader;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "native")
    @GenericGenerator(name = "native", strategy = "native")//AUTO 在mysql中需要指定使用本地策略生成主键值
	private Integer id;//	主键
	
	/**
     * @ManyToOne 使用此标签建立多对一关联，此属性在“多”方使用注解在我们的“一”方属性上
     * @cascade 指定级联操作，以数组方式指定，如果只有一个，可以省略“{}” 多的一方不设置级联
     * @fetch 定义抓取策略
     * @optional 定义是否为必需属性，如果为必需（false），但在持久化时user = null,则会持久化失败
     * @targetEntity 目标关联对象，默认为被注解属性所在类
     */

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "leader_id",unique = false,updatable = false)
	private EquipmentLeader leader;//绑定用户记录
	
	@Column(name="data",length=1024)
	private String data;//监测数据值
	
	@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
	@Column(name="monitorTime")
	private Date monitorTime;//监测日期
	
	@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 
	@Column(name="create_time")
	private Date createTime;//上传日期
	
	@Column(name="imei",length=20)
	private String imei;//机器标识码
	
	//记录上传的字符串
	@Column(name="upstr",length=1024)
	private String upstr;

}
